Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Exercise

Sven

Sven’s colleague, new to FME, built a workspace that calculates the population density of Vancouver neighborhoods. Their workspace reads neighborhood boundary data and writes population density values for 2001 and 2011. Sven wants to turn that workflow into a custom transformer that calculates the average density of items in any area, so other teams in his organization can reuse it.

In this exercise, you will:

1) Open and Run the Starting Workspace

Your colleague’s workspace calculates population density in persons per square kilometer for the years 2001 and 2011. Seeing that output now gives you a baseline to compare against once the custom transformer is in place.

Starting dataset

2) Create Custom Transformer

The critical components for the custom transformer are the AreaCalculator and the ExpressionEvaluator. The workspace contains two ExpressionEvaluators, one for 2001 and one for 2011, but you only need one of them inside the custom transformer.

Right-click > Create Custom Transformer

The filled out Create Custom Transformer dialog

3) Inspect Custom Transformer

Comparing the two tabs shows you both what sits inside the custom transformer and where it sits in the workspace. Because you chose to handle attribute references with user parameters, FME exposes the processed attribute as a parameter on the new transformer.

The new DensityEvaluator custom transformer

The DensityEvaluator Parameters dialog, including a new attribute

4) Save and Run the Workspace

The output should match what you saw in step 1, which confirms the custom transformer behaves the same as the two transformers it replaced. This is only the start of building the DensityEvaluator, and you will make it more generic in the upcoming lessons.

 

Additional Resources